<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\setting;

use app\adminapi\controller\AuthController;
use app\services\system\SystemExtractServices;
use think\facade\App;

/**
 * 提现设置管理
 * Class Article
 * @package app\adminapi\controller\v1\setting
 */
class SystemExtract extends AuthController
{
    /**
     * @var SystemExtractServices
     */
    protected $service;

    /**
     * SharePlatform constructor.
     * @param App $app
     * @param SystemExtractServices $service
     */
    public function __construct(App $app, SystemExtractServices $service)
    {
        parent::__construct($app);
        $this->service = $service;
    }

    /**
     * 获取
     * @return mixed
     */
    public function index()
    {
        $data = $this->service->getInfo(1);
        if($data['id'] > 0){
            unset($data['id']);
        }
        return app('json')->success($data);
    }

    /**
     * 保存数据
     * @return mixed
     */
    public function save()
    {
        $data = $this->request->postMore([
            ["fxy_is_restrict",0],
            ["fxy_extract_price",0],
            ["fxy_extract_number",0],
            ["fxy_commission",0],
            ["jxs_is_restrict",0],
            ["jxs_extract_price",0],
            ["jxs_extract_number",0],
            ["jxs_commission",0],
            ['admin_id',$this->adminId],
            ['admin_name',$this->adminInfo['real_name']],
        ]);
        $this->service->update(1,$data);
        return app('json')->success(100021);
    }
}
